home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
pctj8411.arc
/
DISKTEST.C
< prev
next >
Wrap
Text File
|
1986-09-14
|
1KB
|
47 lines
/* disktest.c - test raw disk i/O */
#include "stdio.h"
#include "ctype.h"
#define ASIZE 25000 /* size of area for a buffer */
long seqio() , randio() ;
char *align() ;
main(argc,argv)
int argc ;
char *argv[] ;
{
int dno , nstart , nseg , i , nit ;
int offset ;
char area[ ASIZE ] ;
float t ;
char *pbuf ;
/* ensure that the buffer does not cross a 64K address boundary */
pbuf = align(area,ASIZE/2) ;
printf(" max. no. of sectors per read = %d \n",ASIZE/(2*512));
printf(" drive number (0=a , 1=b ...) \n") ;
scanf("%d",&dno) ;
printf(" number of sectors per read: \n");
scanf("%d",&nseg) ;
printf(" starting sector number (0 = beginning of disk: \n");
scanf("%d",&nstart) ;
printf(" offset between reads (0=sequential I/O) \n");
scanf("%d",&offset) ;
printf(" number of iterations: \n");
scanf("%d",&nit) ;
if( nseg > 24 )
{ printf(" too many sectors per read \n");
exit(10) ;
}
/* now do the operation */
if( offset == 0 )
t = seqio(dno,nseg,nstart,pbuf,nit) ;
else t = randio(dno,nseg,nstart,pbuf,nit,offset) ;
printf(" %4.2f Seconds \n", t /18.2 ) ;
printf(" %4.3f Seconds per read operation \n", t / (18.2*nit) ) ;
}